package com.IR.order.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.IR.order.service.APreorderBiz;
import com.IR.shop.po.Preorder;

@Controller
public class APreorderAction {
	@Resource
	public APreorderBiz biz;
	private Preorder preorder;
	private List<Preorder> list;
	public Preorder getPreorder() {
		return preorder;
	}
	public void setPreorder(Preorder preorder) {
		this.preorder = preorder;
	}
	public List<Preorder> getList() {
		return list;
	}
	public void setList(List<Preorder> list) {
		this.list = list;
	}
	@RequestMapping(value="deletePreorder.do")
	public void deletePreorder() {
		biz.deletePreorder();
	}
	@RequestMapping(value="savePreorder.do")
	public void savePreorder(HttpServletRequest request,HttpServletResponse response) throws IOException {
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setCharacterEncoding("utf-8");
		Long userid=new Long(request.getParameter("userid"));
		Long proid=new Long(request.getParameter("proid"));
		int normsid=new Integer(request.getParameter("normsid"));
		biz.deletePreorder();
		biz.savePreorder1(userid, proid, normsid);
		PrintWriter out = response.getWriter();
		out.println(1);
	}
}
